home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-21 / qwhite.zip / VIRTUALI.TEC < prev    next >
Text File  |  1992-03-09  |  16KB  |  300 lines

  1. ID:V1 What is Virtualizing?
  2. Quarterdeck Technical Bulletin #229
  3. by Michael Bolton and Eric Wieling
  4.  
  5. Q. What is virtualizing?
  6. Q. What does "virtualize text and graphics" mean?
  7. Q. What does "writes directly to screen" mean?
  8. Q. How can I tell if my program writes directly to screen?
  9. Q. I've set "Runs in background" to Y.  Why isn't my program running in 
  10.    background?
  11.  
  12.  
  13. Q. What is virtualizing?
  14.  
  15. Programs can handle display in three ways in DESQview parlance.  These are 
  16. explained in more detail below, but briefly,
  17.  
  18. 1) the "well-behaved" application uses DOS or your system's BIOS
  19.    services to display its information;
  20.  
  21. 2) the "DESQview-aware" program writes directly to the screen when not
  22.    running under DESQview, but writes to a special area of memory (under
  23.    DESQview's control) so that DESQview may properly manage display of
  24.    multiple windows.
  25.  
  26. 3) the "misbehaved" application writes directly to the screen hardware
  27.    with no consideration for DESQview or any other multitasking
  28.    environment.
  29.  
  30. Misbehaved applications present a special problem for most multitasking 
  31. environments, in that direct screen-writing can "bleed through" into 
  32. foreground windows.   However, on a 386 processor, DESQview 386 (which is 
  33. simply DESQview and QEMM running on the same computer) can "virtualize" 
  34. misbehaved applications; that is, it can fool these applications into 
  35. believing that they have exclusive control of the screen.  Thus, such 
  36. applications may be run in background or in a small window without interfering 
  37. with the display of other applications.
  38.  
  39. The first thing to know about virtualizing is that, unless you are working on 
  40. a 386, 386SX, or i486 machine, AND using DESQview 386, virtualizing means 
  41. little to you; anything less than a 386 is not capable of virtualizing the 
  42. screen, and only DESQview and QEMM (which together comprise DESQview 386) 
  43. provide the memory-mapping services that allow this trick to be performed.  
  44. This is another of the many compelling reasons to move to a 386 processor if 
  45. you have not already done so.  (For the purposes of this discussion, the 
  46. 80386SX, the 80386 (also known as the 80386DX), and the i486 are equivalent; 
  47. all provide the memory-management features of the 386.)
  48.  
  49. Now that we've established that we discuss virtualization only when we refer 
  50. to a 386, we should look at the way programs display information on the 
  51. screen.
  52.  
  53. From DESQview's perspective, there are two basic types of programs, as far as 
  54. display is concerned. The first type of program, the "well-behaved" program in 
  55. DESQview parlance, uses DOS or the system's Basic Input/Output Services (BIOS) 
  56. to put text on the screen.  The BIOS gets information from the program, and 
  57. then puts values into screen memory addresses; these values are then 
  58. translated by the display adapter to show up as the characters that you see on 
  59. your monitor. "Well-behaved" applications, then, use resources built into the 
  60. system to display information.  To run a program in a small window or in 
  61. background, DESQview (without QEMM's help, and on any processor) intercepts 
  62. DOS and BIOS calls and places the results into a "virtual screen."  This is an 
  63. area of memory, or "buffer," the same size as screen memory, which, to the 
  64. application, looks and feels exactly like the real screen.  The application 
  65. therefore behaves as it would if it had the computer all to itself.  The "well- 
  66. behaved" program believes that display work has been done, and continues about 
  67. its business without complaints.
  68.  
  69. Applications which display Hercules, CGA, EGA, or VGA graphics (and this 
  70. includes all programs with graphical user interfaces) normally do not use the 
  71. BIOS.  Because of the greater complexity involved in displaying graphics, such 
  72. programs do not have the option of writing directly to a DESQview memory 
  73. buffer, nor are there BIOS services efficient enough to allow such programs to 
  74. run at a satisfactory speed.  These applications are therefore, by definition, 
  75. NOT well-behaved and are called (predictably) "misbehaved" in DESQview 
  76. parlance.  This type of program avoids DOS and the BIOS, and puts text or 
  77. graphics on the screen itself by writing values directly into screen memory 
  78. addresses.
  79.  
  80. For text-based applications, writing directly to the screen hardware is 
  81. considerably faster than using BIOS calls, so many text applications write 
  82. directly to in the interests of speed.  Graphics-oriented BIOS functions are 
  83. limited in power and flexibility, and in any case are unacceptably slow, so 
  84. graphical applications write directly to the screen.
  85.  
  86. The DESQview-aware program checks for the presence of DESQview (or Microsoft 
  87. Windows, or TopView, an IBM environment with which DESQview is compatible) and 
  88. asks for the address of the memory buffer that DESQview will use to store the 
  89. program's video information.  The program then writes directly to DESQview's 
  90. memory buffer instead of to the video hardware.  This method produces the same 
  91. well-governed results as writing through DOS or the BIOS, and is considerably 
  92. faster.  This type of application is called "DESQview-aware."
  93.  
  94. Writing directly to screen memory addresses eliminates the middleman, but the 
  95. catch is that direct-to-screen display information cannot be intercepted and 
  96. redirected as easily as BIOS calls.  Under anything other than DESQview-386, 
  97. such programs will not run smoothly in background or in a small window.  These 
  98. programs interact directly with the display hardware, and will write outside 
  99. the borders of their DESQview windows; if allowed to run in background or in a 
  100. small window, these programs will "leak" or "bleed" into the display windows 
  101. of other programs.  The alternative is to suspend the operation of this type 
  102. of program while it is in background, which is DESQview's default method of 
  103. managing such programs.  This is quite satisfactory for those who want to use 
  104. DESQview as a task-switching environment, but not for those who desire 
  105. multitasking. 
  106.  
  107. Happily, the 386 processor, QEMM-386, and DESQview, all working together, can 
  108. trap the direct screen writes of misbehaved text or graphics programs and 
  109. redirect the output of these applications to DESQview's video buffers -- also 
  110. called "virtual screens," since as far as the application knows, it is writing 
  111. to the screen.  This process is called "virtualizing." The advantage of 
  112. virtualizing is that, under DESQview 386, misbehaved text programs and even 
  113. programs using Hercules, CGA, EGA, or VGA graphics can run comfortably in 
  114. background or in a small window.
  115.  
  116.  
  117. Q. What, then, is the difference between "virtualizing text" and "virtualizing 
  118.    text AND graphics"?
  119.  
  120. First, memory usage: a memory buffer for a virtualized text screen only takes 
  121. up as much memory (in bytes) as there are places to display a character on the 
  122. screen. That works out to 80 (columns) X 25 (rows) X 2 bytes per character 
  123. (one byte for the character, and the other for its display attribute), for a 
  124. total of 4000 bytes.  If you want to create a virtual screen to catch text-
  125. based data, you won't pay much of a memory penalty.  DESQview uses expanded 
  126. memory to virtualize video output, and expanded memory can only be allocated 
  127. in 16K chunks (called "pages"). Consequently, it costs 16K, rather than 4000 
  128. bytes, of expanded memory to virtualize a text program.  If you want to 
  129. virtualize graphics, though, you'll need as much as 272K of available expanded 
  130. memory, depending on the graphics mode that the program is using.
  131.  
  132. Second, there is a difference in the use of the processor's time.  A 
  133. virtualized text program is approximately as fast as a nonvirtualized text 
  134. program, but virtualizing graphics does take a heavy toll on the processor. 
  135. Incidentally, when you are running a virtualized program full-screen and in 
  136. foreground, DESQview temporarily suspends virtualization and lets the program 
  137. write to the real video memory region; in this circumstance, there is little 
  138. extra processor overhead.
  139.  
  140. Third, it is worth noting that under DESQview 386, even protected mode 
  141. programs, also known as DOS-extended programs, can be multitasked, thanks to a 
  142. memory-management specification, coauthored by Quarterdeck, called the Virtual 
  143. Control Program Interface (VCPI).  It is possible in most circumstances to 
  144. virtualize the text output of a program that runs in protected mode.  This is 
  145. because most protected mode programs actually switch into real mode to write 
  146. text to the screen.  However, programs which write graphics directly to the 
  147. screen while in protected mode cannot be virtualized, so DESQview 386 will by 
  148. default halt the operation of such programs when they are not using the full 
  149. screen.  A newer specification for multitasking, the DOS Protected Mode 
  150. Interface, will allow virtualization of protected-mode programs; future 
  151. versions of DESQview and QEMM are expected to support this specification.
  152.  
  153.  
  154. Q.  How can I tell if my program is writing directly to screen?
  155.  
  156. To tell if an application is writing directly to the video hardware inside 
  157. DESQview, make the following changes in the application's Change a Program 
  158. menu:
  159.  
  160. 1) Set "Writes text directly to screen" to N;
  161.  
  162. 2) Set "Virtualize text/graphics" to N;
  163.  
  164. 3) On the Advanced Options screen, blank out the following four fields in the 
  165. "Window Position" section: Starting Height, Starting Width, Starting Row, and 
  166. Starting Column.  Put blanks in these fields, not zeros.
  167.  
  168. After these changes have been made, open the program. DESQview will place a 
  169. small window border on the screen; if the program comes up and stays within 
  170. the small window border, it does not write directly to the screen.  If the 
  171. program demolishes the window border and takes the full screen, it is writing 
  172. directly to the hardware, and should be virtualized if you wish to run it in 
  173. background or in a small window.
  174.  
  175. Q. Why doesn't my program STAY in background?  It bleeds through on to the 
  176. screen when it's background; even though I've set "Runs in background" to Y, 
  177. the information from this program keeps showing up in the foreground window.
  178.  
  179. If it is an application that writes text or graphics directly to screen, one 
  180. reason might be that it is not set up to virtualize.  You can amend this by
  181.  
  182. 1) selecting Change a Program from the DESQview Open Window Menu,
  183.  
  184. 2) selecting the program that you want to change, and
  185.  
  186. 3) on page one of the Change a Program Menu, setting "Virtualize text and 
  187. graphics" to Y or T.
  188.  
  189.  
  190. Q.  When should I virtualize both text and graphics?
  191.  
  192. If an application does work which you want to continue while the program is in 
  193. background or in a small window, and it is a program that does this work while 
  194. displaying graphics, set "Virtualize text and graphics" to Y.
  195.  
  196. Q. When should I virtualize text only?
  197.  
  198. 1) If you have an application which writes text directly to the screen, but 
  199. never uses graphics, set Virtualize to T.  Misbehaved text-based applications 
  200. are good candidates for this treatment.
  201.  
  202. 2) If you have an application which does write both text and graphics directly 
  203. to the screen, but in which you have no need to run the program in background 
  204. while graphics are being displayed, set Virtualize to T. A good example of 
  205. this type of program is a word processor or a spreadsheet which has a 
  206. graphical element to it (a charting or print preview module, for example) that 
  207. you never need to run in background or in a small window.  Even if you're not 
  208. virtualizing this type of program, you can still place your chart or print 
  209. preview in a small window -- the program simply halts, while retaining the 
  210. information on screen.  You can still use DESQview's screen management to see 
  211. all the parts of the screen you like, but the program's operation is suspended 
  212. while it's in the small window. Recalculating and printing, since they usually 
  213. take place while the screen is in text mode, can typically continue to run in 
  214. background in such programs, since the text mode of the program is being 
  215. virtualized.
  216.  
  217. 3) If you have an application which writes text in real mode, but writes 
  218. graphics to the screen while in protected mode, again set "Virtualize text and 
  219. graphics" to T.  Do this because the program can still be virtualized while 
  220. it's in text mode, even though it can't be virtualized while it's displaying 
  221. graphics.
  222.  
  223. Q. I've done all these things and my program STILL won't run in background. 
  224. What's wrong?
  225.  
  226. There are a few possibilities.
  227.  
  228. You may have set "Virtualize Text and Graphics" on Page 1 of the program's 
  229. Change a Program Menu to N.
  230.  
  231. Solution: set Virtualize Text and Graphics to Y
  232.  
  233. You may simply be out of memory; when DESQview virtualizes an application's 
  234. graphics, it can require up to 272K of free expanded memory.
  235.  
  236. Solution: make sure that you have enough memory available for virtualizing.  
  237. If you have several applications open, close down one or more.  You might also 
  238. want to consider upgrading your system by adding more memory.
  239.  
  240. DESQview 386 cannot virtualize if you have set the Expanded Memory Page Frame 
  241. to 0 with QEMM's FRAME=NONE or FRAMELENGTH=0 parameters.
  242.  
  243. Solution: make sure neither of the above parameters are on the QEMM line in 
  244. CONFIG.SYS.
  245.  
  246. Although DESQview can save and restore most video modes, there are a few that 
  247. it can't virtualize.
  248.  
  249. Solution: try using a lower resolution for the program in question. Text mode, 
  250. sometimes known as "CGA mode" for some programs, is a good place to start.  
  251. "CGA mode" is something of a misnomer, since you'll actually still get your 
  252. normal resolution on an EGA or VGA -- the program just writes to the screen 
  253. without being in graphics mode.
  254.  
  255. To virtualize graphics, you may need more graphics pages.
  256.  
  257. Solution: on the Advanced Options screen of the Change a Program Menu, set 
  258. Graphics Pages to a higher number, such as 2 or 3.
  259.  
  260. You may not have enough Real Alternate Maps to virtualize a large number of 
  261. windows.
  262.  
  263. Solution: QEMM must provide DESQview with a Real Alternate Map for each 
  264. virtualized window.  Since QEMM's default number of Real Alternate Maps is 8, 
  265. if you are using more than 8 windows, you'll be unable to virtualize window 9.  
  266. Close down an application or two, or specify MAPS=n on the QEMM line in 
  267. CONFIG.SYS, where n is a number larger than 8.  Numbers larger than 20 are 
  268. unlikely to be helpful.
  269.  
  270. Programs that start as part of a DESQview startup script, and are put into 
  271. background by the script, may not virtualize if they change video modes; when 
  272. the video mode changes, they will be suspended.
  273.  
  274. Solution: for this type of program, make sure that "Runs in Background" is set 
  275. to Y, and is not left blank.
  276.  
  277. A program may be grabbing a hardware interrupt, and may write directly to 
  278. screen from inside its hardware interrupt handler.
  279.  
  280. Solution: in this unusual circumstance, use Manifest in TSR mode, and then 
  281. load your program.  Look at Manifest's First Meg / Interrupts screen to 
  282. determine the software interrupt which corresponds to the hardware interrupt 
  283. the program is grabbing.  When you want to run this program under DESQview, 
  284. use the DESQview startup parameter /HW:nn:V, where nn is the number, in 
  285. hexadecimal, of the software interrupt above. This will allow DESQview to 
  286. virtualize screen writes that occur inside the hardware interrupt handler.
  287.  
  288.      Finally, it should be noted that DESQview 386 is presently the only 
  289. program in existence that will multitask and virtualize misbehaved DOS 
  290. applications which use EGA and VGA graphics.  Virtualization is one of the 
  291. principal ways by which DESQview can multitask these applications; 
  292. understanding the above ideas about virtualization can help you to take the 
  293. greatest advantage of DESQview's power.
  294.  
  295.   ************************************************************************
  296.   *This technical note may be copied and distributed freely as long as it*
  297.   *is distributed in its entirety and it is not distributed for profit.  *
  298.   *          Copyright (C) 1991 by Quarterdeck Office Systems            *
  299.   ************************ E N D   O F   F I L E *************************
  300.